#include "FiveWin.ch"
#include "Visual.ch"

#ifdef __XPP__
   #define Super ::TWindow
#endif


memvar oIDE

//----------------------------------------------------------------//

CLASS TWndPrj FROM TWindow

   DATA   aPrograms    AS ARRAY  INIT {}
   DATA   aForms       AS ARRAY  INIT {}
   DATA   aDataBases   AS ARRAY  INIT {}

   DATA   cMainPrg
   DATA   cName

   DATA   oWndCode

   DATA   oBrw

   DATA   oHand        // BottonBar cursor used
   DATA   oDlgBuild    

   CLASSDATA lRegistered AS LOGICAL



   DATA   cCompiler ,;
   				cPathLib  ,;
   				cChPath   ,;
   				cObjPath ,;
   				cLinker  ,;
   				cRcName  ,;
   				cMoreOpt,;
   				cLibFWH
   				

   DATA 	aLib
   				
   
	DATA  oProjectOpt 
	DATA  nCompiler  INIT HARBOUR
	
   METHOD New( cName ) CONSTRUCTOR
   METHOD OPEN( cName )

   METHOD Build( lDebug )  // Builds the entire project
   METHOD BuildBar()
   METHOD Close()
   METHOD NewForm()

   METHOD Run( cArguments )
   METHOD Debug( cArguments ) INLINE ::Run( cArguments, .t. )

   METHOD AddItem()
   METHOD DelItem()
   METHOD GetItems()

   METHOD OpenForm( cFormName )

   METHOD SelItems( nOption )  // Changes visible items when TABs changes

   METHOD ResetClick()  INLINE ASend( ::aForms, "_bLClicked", nil )

   #ifndef __XPP__
      METHOD ResetCursor() INLINE ASend( ::aForms, "_SetCursor" )
   #else
      METHOD ResetCursor() INLINE ASend( ::aForms, "_SetCursor()" )
   #endif

   METHOD Save()

   #ifndef __XPP__
      METHOD Show() INLINE ASend( ::aForms, "Show" ), Super:Show()
   #else
      METHOD Show() INLINE ASend( ::aForms, "Show()" ), Super:Show()
   #endif

ENDCLASS

//----------------------------------------------------------------//

METHOD New( cName ) CLASS TWndPrj

   local oFont
   local cProject := '#include "FiveWin.ch"' + CRLF + CRLF + ;
      "//-----------------------------------------------------------------------//" + CRLF + CRLF + ;
      "function Main()" + CRLF + CRLF + ;
      "   public oApplication, oForm1" + CRLF + CRLF + ;
      "   oApplication = TApplication():New()" + CRLF + CRLF + ;
      "   oApplication:AddForm( oForm1 := TForm1():New() )" + CRLF + CRLF + ;
      "   oApplication:Run()" + CRLF + CRLF + ;
      "return nil" + CRLF + CRLF + ;
      "//-----------------------------------------------------------------------//"

   DEFAULT cName := "project1.fpr"

   DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -8

   ::cName    = cName
   ::cMainPrg = "form1.prg"

   Super:New( 18, 48, 40, 116, "Project manager: " + cName )

   DEFINE ICON ::oIcon RESOURCE "Project"

   DEFINE CURSOR ::oHand HAND
   
   ::BuildBar()
   
   @  1, 0 LISTBOX ::oBrw FIELDS "" ;
      HEADERS "", "Name", "Description" ;
      COLSIZES 15, 80, 200 ;
      FONT oFont ;
      OF Self

   ::oWndCode = oIDE:oWndCode

   ::oWndCode:AddPage( "project1.prg", cProject )
   AAdd( ::aPrograms, { "project1.prg", "" } )

   ::oBrw:SetArray( ::aPrograms )
   ::oBrw:bLine = { || ::GetItems() }
   ::oClient = ::oBrw

   @  5, 0 TABS ::oBottom ;
      ITEMS "&Programs", "&Forms", "&DataBases", "&Resources",;
            "&Files", "&Libraries" ;
      ACTION ::SelItems( nOption ) ;
      OF Self

   // We don't let this window be destroyed. We just hide it
   ::bValid = { || ::Hide(), .f. }
	 
	 if oIde:lNew   
	 	::oProjectOpt := oIde:oGeneralOpt
	 else
   	::oProjectOpt := TOptionsComp():New( ::cName, PROJECT )
   	::oProjectOpt:CompilerIni()
   endif

return Self

//----------------------------------------------------------------//


METHOD Open( cName ) CLASS TWndPrj

   local oFont, cProject, oIni, oBrw
	 local cPrg, n:= 1
	 
	 ::cName    = cName
	 //cName := cFile( ::cName )
   ::oProjectOpt := TOptionsComp():New( ::cName, PROJECT )
   oIde:lNew := .f.
   ::oProjectOpt:CompilerIni()


   DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -8

	
   Super:New( 18, 48, 40, 116, "Project manager: " + cName )

   DEFINE ICON ::oIcon RESOURCE "Project"

   DEFINE CURSOR ::oHand HAND
   
   ::BuildBar()
   @  1, 0 LISTBOX ::oBrw FIELDS "" ;
      HEADERS "", "Name", "Description" ;
      COLSIZES 15, 80, 200 ;
      FONT oFont ;
      OF Self

   ::oWndCode = oIDE:oWndCode
    oIni = TIni():New( cName )

    While ! Empty( cPrg := oIni:Get( "PROGRAMS", AllTrim( Str( n++ ) ) ) )
    	cProject := MemoRead( cPrg )
    	if n = 1
    		::cMainPrg = cPrg
    	endif
    	::oWndCode:AddPage( cPrg, cProject )
    	AAdd( ::aPrograms, { cPrg, "" } )
    end
    

   ::oBrw:SetArray( ::aPrograms )
   ::oBrw:bLine = { || ::GetItems() }
   ::oClient = ::oBrw

   @  5, 0 TABS ::oBottom ;
      ITEMS "&Programs", "&Forms", "&DataBases", "&Resources",;
            "&Files", "&Libraries" ;
      ACTION ::SelItems( nOption ) ;
      OF Self

   // We don't let this window be destroyed. We just hide it
   ::bValid = { || ::Hide(), .f. }
   

return Self

//----------------------------------------------------------------//




METHOD Build( lDebug ) CLASS TWndPrj

   local oAction, oResult, cResult := "", oBtnCancel, n, lCancel := .f.
   local aFileInfo, cLinkFile := "", cRC := "", cFormName, cRCName
   local cManifesto := "", nMani

   DEFAULT lDebug := .f.

	 if !oIde:lNew
	   if ! ::Save()
	      return nil
	   endif
	 else
	   if ! oIde:SaveAs()
	      return nil
	   endif
	endif	 	
   
   if ::oDlgBuild != nil
      ::oDlgBuild:End()
   endif   

   if ::oProjectOpt:nCompiler == HARBOUR
   	::cCompiler := trim( ::oProjectOpt:cHPath )+"\harbour.exe"
   	::cPathLib	:= trim( ::oProjectOpt:cHLibPath )
   	::aLib  		:= AClone( ::oProjectOpt:aLibH )
   	::cCHPath   := trim( ::oProjectOpt:cHCHPath )
   	::cMoreOpt	:= trim( ::oProjectOpt:cHMoreOpt ) + ::oProjectOpt:cHOptHide
   	::cLibFWH  	:= "FiveH.lib"
   else
   	::cCompiler := trim( ::oProjectOpt:cXHPath )+"\harbour.exe"
   	::cPathLib	:= trim( ::oProjectOpt:cXHLibPath )
   	::aLib  		:= AClone ( ::oProjectOpt:aLibXH )
   	::cCHPath   := trim( ::oProjectOpt:cXHCHPath )
   	::cMoreOpt	:= trim( ::oProjectOpt:cXHMoreOpt ) + ::oProjectOpt:cXHOptHide
   	::cLibFWH  	:= "FiveHX.lib"
	 endif


   DEFINE DIALOG ::oDlgBuild RESOURCE "Build"

   REDEFINE SAY PROMPT ( "Project: " + ::cName ) ID ID_PROJECT OF ::oDlgBuild
   REDEFINE SAY oAction PROMPT ( "Compiling: " + ::aPrograms[ 1 ][ 1 ] ) ID ID_ACTION OF ::oDlgBuild
   REDEFINE GET oResult VAR cResult ID ID_RESULT OF ::oDlgBuild MEMO READONLY
   REDEFINE BUTTON oBtnCancel ID IDCANCEL ACTION ( lCancel := .t., ::oDlgBuild:End() )

   ACTIVATE DIALOG ::oDlgBuild CENTERED NOWAIT

   for n = 1 to Len( ::aPrograms )


         oAction:SetText( "Compiling: " + ::aPrograms[ n ][ 1 ] )
         MemoWrit( trim( ::oProjectOpt:cPrjOutPut )+"\comp_prg.bat",;
                   ::cCompiler + " " + ;
                   trim( ::oProjectOpt:cPrjSource )+"\"+cFileNoPath( ::aPrograms[ n ][ 1 ] ) + ;
									 " /i" + ::cChPath + ";"+ trim( ::oProjectOpt:cCHFW ) + ;
									 " /o" + trim( ::oProjectOpt:cPrjObj ) + "\ " + ::cMoreOpt + " > " + ;
									 trim( ::oProjectOpt:cPrjOutPut )+"\comp_prg.log" ) 
									 
         WaitRun( trim( ::oProjectOpt:cPrjOutPut )+"\comp_prg.bat", 0 )
         oResult:SetText( cResult += CRLF + MemoRead( trim( ::oProjectOpt:cPrjOutPut )+"\comp_prg.log" ) )
         if "error" $ Lower( cResult )
            while ! lCancel
               SysRefresh()
            end
         endif

         MemoWrit( trim( ::oProjectOpt:cPrjOutPut ) + "\comp_c.bat" ,;
   								 trim( ::oProjectOpt:cCompilerC ) + " " + trim( ::oProjectOpt:cCFlag ) + ;
   								 " -I" + trim( ::cChPath ) + ;
   								 " -n" + trim( ::oProjectOpt:cPrjObj )+"\" +;
   								 " " + trim( ::oProjectOpt:cPrjObj )+"\"+cFileNoExt( cFileNoPath( ::aPrograms[ n ][ 1 ] ) ) + ".c" + ;
                   " > " + trim( ::oProjectOpt:cPrjOutPut )+"\comp_c.log" )
                   
                    //  + CRLF + "type comp.log" ) // + CRLF + "pause" )
                    
                    
         WaitRun( trim( ::oProjectOpt:cPrjOutPut )+"\comp_c.bat", 0 )
         oResult:SetText( cResult += CRLF + MemoRead( trim( ::oProjectOpt:cPrjOutPut )+"\comp_c.log" ) )
      /* endif */

      if lCancel
         exit
      endif
   next

   // Now we compile the resources
		if ::oProjectOpt:lWndStyle
		
			if !file( trim( ::oProjectOpt:cPrjRes ) + "\visualfw.man" )
			cManifesto:= "<?xml version="+'"1.0"'+" encoding="+'"UTF-8"'+" standalone="+'"yes"'+"?>"+CRLF+;
										"<assembly xmlns="+'"urn:schemas-microsoft-com:asm.v1" '+"manifestVersion="+'"1.0"'+">"+CRLF+;
										"<assemblyIdentity"+CRLF+;
										"    name="+'"Visual FiveWin"'+CRLF+;
										"    processorArchitecture="+'"x86"'+CRLF+;
										"    version="+'"2.4.7.0"'+CRLF+;
										"    type="+'"win32"'+"/>"+CRLF+;
										"<description>Windows Shell</description>"+CRLF+;
										"<dependency>"+CRLF+;
										"    <dependentAssembly>"+CRLF+;
										"        <assemblyIdentity"+CRLF+;
										"            type="+'"win32"'+CRLF+;
										"            name="+'"Microsoft.Windows.Common-Controls"'+CRLF+;
										"            version="+'"6.0.0.0"'+CRLF+;
										"            processorArchitecture="+'"x86"'+CRLF+;
										"            publicKeyToken="+'"6595b64144ccf1df"'+CRLF+;
										"            language="+'"*"'+CRLF+;
										"       />"+CRLF+;
										"    </dependentAssembly>"+CRLF+;
										"</dependency>"+CRLF+;
										"</assembly>"
										
					nMani := fCreate( trim( ::oProjectOpt:cPrjRes ) + "\visualfw.man", 0 )
					fWrite( nMani, cManifesto )
					fClose( nMani )
					//MemoWrit( trim( ::oProjectOpt:cPrjRes ) + "\visualfw.man" , cManifesto,.F. )
				endif
		endif

	// now create Icon Form
	createicon( trim( ::oProjectOpt:cPrjRes ) )

   cRC += "1 ICON "+ trim( ::oProjectOpt:cPrjRes )+"\form.ico" + CRLF
   if ::oProjectOpt:lWndStyle
   	cRC += '1 24 '+trim( ::oProjectOpt:cPrjRes ) + "\visualfw.man" + CRLF 
   endif
   //? len( ::aForms ) 
   for n = 1 to Len( ::aForms )
      cFormName = trim( ::oProjectOpt:cPrjRes )+ "\"+Lower( cFileNoExt( cFileNoPath( ::aForms[ n ]:cFileName ) ) )
      cRC += ::aForms[ n ]:cClassName + ' FORMS "' + cFormName + '.ffm"' + CRLF
      ::aForms[ n ]:SaveFile( trim( ::oProjectOpt:cPrjRes )+ "\"+Lower( cFileNoExt( cFileNoPath( ::aForms[ n ]:cFileName ) ) ) + ".ffm")
   next   

   cRCName = trim( ::oProjectOpt:cPrjRes )+"\"+Lower( cFileNoExt( cFileNoPath( ::aPrograms[ 1 ][ 1 ] ) ) ) + ".rc"
   MemoWrit( cRCName, cRC )
   MemoWrit( trim( ::oProjectOpt:cPrjOutPut )+"\comp_rc.bat", ;
   					 trim( ::oProjectOpt:cResCompiler ) + " -r " + ;
   					 " -fo " + trim( ::oProjectOpt:cPrjRes )+"\" + Lower( cFileNoExt( cFileNoPath( ::aPrograms[ 1 ][ 1 ] ) ) ) + ".res" +;
   					 " " + cRCName + " > " +;
   					 trim( ::oProjectOpt:cPrjOutPut )+"\comp_rc.log" ) // + CRLF + "pause" )
   					 
   WaitRun( trim( ::oProjectOpt:cPrjOutPut )+"\comp_rc.bat", 0 )
   
   oResult:SetText( cResult += CRLF + MemoRead( trim( ::oProjectOpt:cPrjOutPut )+"\comp_rc.log" ) )
 
   // Now we build the link file

   cLinkFile += trim( ::oProjectOpt:cLnkLibs )+"\c0w32.obj +" + CRLF

   for n = 1 to Len( ::aPrograms )
      cLinkFile += trim( ::oProjectOpt:cPrjObj )+"\"+cFileNoExt( cFileNoPath( ::aPrograms[ n ][ 1 ] ) ) + ".obj " 
   next
   cLinkFile += ", +" + CRLF

   cLinkFile += trim( ::oProjectOpt:cPrjMain )+"\"+Lower( cFileNoExt( cFileNoPath( ::aPrograms[ 1 ][ 1 ] ) ) ) + ".exe, +" + CRLF
   cLinkFile += trim( ::oProjectOpt:cPrjOutPut )+"\"+Lower( cFileNoExt( cFileNoPath( ::aPrograms[ 1 ][ 1 ] ) ) ) + ".map, +" + CRLF

	 
   cLinkFile += trim( ::oProjectOpt:cLibFW ) + "\"+::cLibFWH + " " +trim( ::oProjectOpt:cLibFW ) + "\FiveHC.lib +" + CRLF
//   "c:\FWH\lib\FiveH.lib c:\FWH\lib\FiveHC.lib + " + CRLF
	
	 for n = 1 to len( ::aLib )
	 	cLinkFile += ::cPathLib + "\"+::aLib[ n ] + " + " +CRLF
	 next

/*
   cLinkFile += "c:\harbour\lib\hbrtl.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\hbvm.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\gtgui.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\hblang.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\hbmacro.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\hbrdd.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\rddntx.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\rddcdx.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\rddfpt.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\hbsix.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\hbdebug.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\hbcommon.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\hbpp.lib + " + CRLF
   cLinkFile += "c:\harbour\lib\hbw32.lib + " + CRLF
 */

	 for n = 1 to len( ::oProjectOpt:aLnkLibs )
	 	cLinkFile += trim( ::oProjectOpt:cLnkLibs ) + "\"+::oProjectOpt:aLnkLibs[ n ] + ;
	 	if ( n != len( ::oProjectOpt:aLnkLibs ), " +",",") + CRLF
	 next
 
/* 
   cLinkFile += "c:\bcc55\lib\cw32.lib + " + CRLF
   cLinkFile += "c:\bcc55\lib\psdk\odbc32.lib + " + CRLF
   cLinkFile += "c:\bcc55\lib\psdk\nddeapi.lib + " + CRLF
   cLinkFile += "c:\bcc55\lib\psdk\iphlpapi.lib + " + CRLF
   cLinkFile += "c:\bcc55\lib\psdk\msimg32.lib + " + CRLF
   cLinkFile += "c:\bcc55\lib\psdk\rasapi32.lib + " + CRLF
   cLinkFile += "c:\bcc55\lib\import32.lib," + CRLF
*/

   cLinkFile += trim( ::oProjectOpt:cPrjRes )+"\"+Lower( cFileNoExt( cFileNoPath( ::aPrograms[ 1 ][ 1 ] ) ) ) + ".res" + CRLF

   /* if File( cFileNoExt( ::aPrograms[ 1 ][ 1 ] ) + ".exe" ) .and. ;
      FDate( cFileNoExt( ::aPrograms[ 1 ][ 1 ] ) + ".exe" ) >= ;
      FDate( ::aPrograms[ 1 ][ 1 ] ) .and. ;
      FTime( cFileNoExt( ::aPrograms[ 1 ][ 1 ] ) + ".exe" ) >= ;
      FTime( ::aPrograms[ 1 ][ 1 ] )
      oAction:SetText( "up to date" )
   else */

      oAction:SetText( "Linking..." )
      MemoWrit( trim( ::oProjectOpt:cPrjOutPut )+"\b32.bc", cLinkFile )

      MemoWrit( trim( ::oProjectOpt:cPrjOutPut )+"\link32.bat", ;
      					trim( ::oProjectOpt:cLnkName ) +" " + ;
      					trim( ::oProjectOpt:cLnkFlags ) + " @" + trim( ::oProjectOpt:cPrjOutPut )+"\b32.bc > " + ;
      					trim( ::oProjectOpt:cPrjOutPut )+"\link.log" ) // + ;
      					
      WaitRun( trim( ::oProjectOpt:cPrjOutPut )+"\link32.bat", 0 )
      
      oResult:SetText( cResult += CRLF + MemoRead( trim( ::oProjectOpt:cPrjOutPut )+"\link.log" ) )
      oAction:SetText( "Done" )
      if "Fatal" $ cResult .or. "Error" $ cResult
         oAction:SetText( "Linking errors" )
         while ! lCancel
            SysRefresh()
         end
      endif
   /* endif */

   // oDlg:End()
   oBtnCancel:SetText( "&Close" )

return nil

//----------------------------------------------------------------//

METHOD BuildBar() CLASS TWndPrj

   DEFINE BUTTONBAR ::oBar SIZE 30, 30 OF Self 2007

   DEFINE BUTTON OF ::oBar RESOURCE "additem" ;
      TOOLTIP "Add item" ;
      ACTION  ::AddItem() NOBORDER

   DEFINE BUTTON OF ::oBar RESOURCE "delete" ;
      TOOLTIP "Delete item" ;
      ACTION  ::DelItem() NOBORDER

   DEFINE BUTTON OF ::oBar GROUP RESOURCE "setup" ;
      TOOLTIP "Setup" ;
      ACTION ::Setup() NOBORDER

   DEFINE BUTTON OF ::oBar RESOURCE "build" ;
      TOOLTIP "Build" ;
      ACTION  ::Build() NOBORDER

   DEFINE BUTTON OF ::oBar RESOURCE "run" ;
      TOOLTIP "Run" ;
      ACTION  ::Run( oIde:cArguments ) NOBORDER

   DEFINE BUTTON OF ::oBar RESOURCE "debug" ;
      TOOLTIP "Debug" ;
      ACTION  ::Run( oIde:cArguments, .T. ) NOBORDER

   AEval( ::oBar:aControls, { | o | o:oCursor := ::oHand } )

return nil

//----------------------------------------------------------------//

METHOD NewForm() CLASS TWndPrj

   local oForm := TDesigner():New()

   local cCode := '#include "FiveWin.ch"' + CRLF + CRLF + ;
      "//-----------------------------------------------------------------------//" + CRLF + CRLF + ;
      "CLASS " + oForm:cClassName + " FROM TForm" + CRLF + CRLF + ;
      "   METHOD New() CONSTRUCTOR" + CRLF + CRLF + ;
      "ENDCLASS" + CRLF + CRLF + ;
      "//-----------------------------------------------------------------------//" + CRLF + CRLF + ;
      "METHOD New() CLASS " + oForm:cClassName + CRLF + CRLF + ;
      "   Super:New()" + CRLF + CRLF + ;
      "return Self" + CRLF + CRLF + ;
      "//-----------------------------------------------------------------------//"

      // '   #include "' + Lower( cFileNoExt( oForm:cFileName ) ) + '.frm"' + CRLF + CRLF + ;
   AAdd( ::aPrograms, { oForm:cPrgName, "" } )
   AAdd( ::aForms, oForm )
   oForm:oEdit = ::oWndCode:AddPage( oForm:cPrgName, cCode )

return oForm
//----------------------------------------------------------------//

METHOD OpenForm( cFormName ) CLASS TWndPrj

   local oForm, cPrgName


   if ! File( cFormName )
      MsgAlert( "Form " + cFormName + " not found!" )
      return nil
   endif

   if ! File( cPrgName := trim( ::oProjectOpt:cPrjSource ) + "\"+ cFileNoExt( cFormName ) + ".prg" )
      MsgAlert( "Source code " + cPrgName + " of Form " + cFormName +  " not found!" )
      return nil
   endif

   oForm = TDesigner():New()
   oForm:LoadFile( cFormName )

   AAdd( ::aForms, oForm )
   AEval( oForm:aControls, { | oCtl | oCtl:lDrag := .t. } )
   if Len( oForm:aControls ) > 0
      oForm:aControls[ 1 ]:CheckDots()
   endif

   oForm:Show()
   oForm:cFileName = cFormName
   oForm:cPrgName  = cPrgName

   if ::oWndCode == nil
      ::oWndCode = TWndCode():New( oForm )
   endif
   ::oWndCode:AddPage( cPrgName, MemoRead( cPrgName ) )

return oForm

//----------------------------------------------------------------//

METHOD Close() CLASS TWndPrj

   local n

   for n = 1 to Len( ::aForms )
       ::aForms[ n ]:bValid = { || .t. }
       ::aForms[ n ]:End()
   next


   ::aForms[ 1 ]:nForms = 0  // reset CLASSDATA nForms
   ::oWndCode = nil
   ::bValid   = nil
		
		oIde:oItForms:bAction:DelItems()
	
   if ::oDlgBuild != nil
      ::oDlgBuild:End()
   endif   
   ::End()


return nil

//----------------------------------------------------------------//

METHOD Run( cArguments, lDebug ) CLASS TWndPrj

   DEFAULT lDebug := .f.

   ::Build( lDebug )

   if File( trim( ::oProjectOpt:cPrjMain )+"\"+cFileNoExt( ::aPrograms[ 1 ][ 1 ] ) + ".exe" )
      WinExec( trim( ::oProjectOpt:cPrjMain )+"\"+cFileNoExt( ::aPrograms[ 1 ][ 1 ] ) + " " + cArguments )
   endif

return nil

//----------------------------------------------------------------//

METHOD AddItem() CLASS TWndPrj

   local cFileName

   do case
      case ::oBottom:nOption == 1
           cFileName = cGetFile( "*.prg", "Select a Program" )
           if ! Empty( cFileName )
              if ! File( cFileName )
                 MsgStop( "I can't find that file!" )
              else
                 AAdd( ::aPrograms, { cFileName, "" } )
                 ::oBrw:Refresh()
              endif
           endif

      case ::oBottom:nOption == 2
           cFileName = cGetFile( "*.ffm", "Select a Form" )
           if ! Empty( cFileName )
              if ! File( cFileName )
                 MsgStop( "I can't find that file!" )
              else
                 AAdd( ::aForms, { cFileName, "" } )
                 ::oBrw:Refresh()
              endif
           endif

      case ::oBottom:nOption == 3
           cFileName = cGetFile( "*.dbf", "Select a DataBase" )
           if ! Empty( cFileName )
              if ! File( cFileName )
                 MsgStop( "I can't find that file!" )
              else
                 AAdd( ::aDataBases, { cFileName, "" } )
                 ::oBrw:Refresh()
              endif
           endif

   endcase

return nil

//----------------------------------------------------------------//

METHOD DelItem() CLASS TWndPrj

   do case
      case ::oBottom:nOption == 1
           if Len( ::aPrograms ) > 0
              ASize( ::aPrograms, Len( ::aPrograms ) - 1 )
              ::oBrw:Refresh()
           endif

      case ::oBottom:nOption == 2
           if Len( ::aForms ) > 0
              ASize( ::aForms, Len( ::aForms ) - 1 )
              ::oBrw:Refresh()
           endif

      case ::oBottom:nOption == 3
           if Len( ::aDataBases ) > 0
              ASize( ::aDataBases, Len( ::aDataBases ) - 1 )
              ::oBrw:Refresh()
           endif
   endcase

return nil

//----------------------------------------------------------------//

METHOD GetItems() CLASS TWndPrj

   do case
      case ::oBottom:nOption == 1
           if Len( ::aPrograms ) > 0
              return { 0, Lower( cFileNoPath( ::aPrograms[ ::oBrw:nAt ][ 1 ] ) ),;
                       ::aPrograms[ ::oBrw:nAt ][ 2 ] }
           else
              return { "" }
           endif

      case ::oBottom:nOption == 2
           if Len( ::aForms ) > 0
              return { 0, Lower( cFileNoPath( ::aForms[ ::oBrw:nAt ][ 2 ] ) ),;
                       ::aForms[ ::oBrw:nAt ][ 3 ] }
           else
              return { "" }
           endif

      case ::oBottom:nOption == 3
           if Len( ::aDataBases ) > 0
              return { 0, Lower( cFileNoPath( ::aDataBases[ ::oBrw:nAt ][ 1 ] ) ),;
                       ::aDataBases[ ::oBrw:nAt ][ 2 ] }
           else
              return { "" }
           endif
   endcase

return nil

//----------------------------------------------------------------//

METHOD SelItems( nOption ) CLASS TWndPrj

   do case
      case nOption == 1
           ::oBrw:SetArray( ::aPrograms )
           ::oBrw:bLine = { || { 0, ::aPrograms[ ::oBrw:nAt ][ 1 ],;
                                    ::aPrograms[ ::oBrw:nAt ][ 2 ] } }
           ::oBrw:Refresh()

      case nOption == 2
           ::oBrw:SetArray( ::aForms )
           ::oBrw:bLine = { || { 0, ::aForms[ ::oBrw:nAt ]:cFileName,;
                                    ::aForms[ ::oBrw:nAt ]:cDescription } }
           ::oBrw:Refresh()

      case nOption == 3
           ::oBrw:SetArray( ::aDataBases )
           ::oBrw:Refresh()
   endcase

return nil

//----------------------------------------------------------------//

METHOD Save() CLASS TWndPrj

   local cProject, cClpName, n, cFile, cFolder, cPath
   local cForms  := "", cPrograms := "", cRcText := ""
	 local oIni
	 local cOldPath


  ::oWndCode:SaveAll()
  AEval( ::aForms,;
        { | oForm | MemoWrit( Lower( trim( oIde:oProject:oProjectOpt:cPrjRes)+"\"+oForm:cFileName  ), oForm:Save() ) } )
   
   
   if File( ::cName ) .and. oIde:lNew
      if !  MsgYesNo( ::cName + " already exists on disk" + CRLF + ;
                      "Do you want to overwrite it ?" )
         return .f.
      endif
   endif


   INI oIni FILENAME ::cName
			
		for n = 1 to len( ::aPrograms )
			SET SECTION "PROGRAMS" ENTRY AllTrim( Str( n ) ) OF oIni ;
			TO LOWER(trim( oIde:oProject:oProjectOpt:cPrjSource)+"\"+cFileNoPath( ::aPrograms[ n ][ 1 ] ) )

		next

		for n = 1 to len( ::aForms )
			//? cFileNoPath( ::aForms[ n ]:cFileName ), "save from project"
			SET SECTION "FORMS" ENTRY AllTrim( Str( n ) ) OF oIni ;
			TO LOWER( trim( oIde:oProject:oProjectOpt:cPrjRes)+"\"+cFileNoPath( ::aForms[ n ]:cFileName ) )
		next

		ENDINI
		

return .t.

//----------------------------------------------------------------------------//


Procedure CreateIcon(cPath)

local nIco
nIco := fCreate( cPath+"\Form.ico", 0 )
fWrite( nIco, FormIcon() )
fClose( nIco )


return 

#pragma BEGINDUMP

#include <hbapi.h>

HB_FUNC( FORMICON )
{
   char icon[] = {
0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x08,
0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00,
0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0x00, 0xC0, 0xDC,
0xC0, 0x00, 0xF0, 0xCA, 0xA6, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x33, 0x00,
0x33, 0x00, 0x33, 0x33, 0x00, 0x00, 0x16, 0x16, 0x16, 0x00, 0x1C, 0x1C, 0x1C, 0x00, 0x22, 0x22,
0x22, 0x00, 0x29, 0x29, 0x29, 0x00, 0x55, 0x55, 0x55, 0x00, 0x4D, 0x4D, 0x4D, 0x00, 0x42, 0x42,
0x42, 0x00, 0x39, 0x39, 0x39, 0x00, 0x80, 0x7C, 0xFF, 0x00, 0x50, 0x50, 0xFF, 0x00, 0x93, 0x00,
0xD6, 0x00, 0xFF, 0xEC, 0xCC, 0x00, 0xC6, 0xD6, 0xEF, 0x00, 0xD6, 0xE7, 0xE7, 0x00, 0x90, 0xA9,
0xAD, 0x00, 0x00, 0xFF, 0x33, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00,
0xCC, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x33, 0x33, 0x00, 0x00, 0x33, 0x66, 0x00, 0x00, 0x33,
0x99, 0x00, 0x00, 0x33, 0xCC, 0x00, 0x00, 0x33, 0xFF, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x66,
0x33, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x99, 0x00, 0x00, 0x66, 0xCC, 0x00, 0x00, 0x66,
0xFF, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x99, 0x33, 0x00, 0x00, 0x99, 0x66, 0x00, 0x00, 0x99,
0x99, 0x00, 0x00, 0x99, 0xCC, 0x00, 0x00, 0x99, 0xFF, 0x00, 0x00, 0xCC, 0x00, 0x00, 0x00, 0xCC,
0x33, 0x00, 0x00, 0xCC, 0x66, 0x00, 0x00, 0xCC, 0x99, 0x00, 0x00, 0xCC, 0xCC, 0x00, 0x00, 0xCC,
0xFF, 0x00, 0x00, 0xFF, 0x66, 0x00, 0x00, 0xFF, 0x99, 0x00, 0x00, 0xFF, 0xCC, 0x00, 0x33, 0xFF,
0x00, 0x00, 0xFF, 0x00, 0x33, 0x00, 0x33, 0x00, 0x66, 0x00, 0x33, 0x00, 0x99, 0x00, 0x33, 0x00,
0xCC, 0x00, 0x33, 0x00, 0xFF, 0x00, 0xFF, 0x33, 0x00, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33,
0x66, 0x00, 0x33, 0x33, 0x99, 0x00, 0x33, 0x33, 0xCC, 0x00, 0x33, 0x33, 0xFF, 0x00, 0x33, 0x66,
0x00, 0x00, 0x33, 0x66, 0x33, 0x00, 0x33, 0x66, 0x66, 0x00, 0x33, 0x66, 0x99, 0x00, 0x33, 0x66,
0xCC, 0x00, 0x33, 0x66, 0xFF, 0x00, 0x33, 0x99, 0x00, 0x00, 0x33, 0x99, 0x33, 0x00, 0x33, 0x99,
0x66, 0x00, 0x33, 0x99, 0x99, 0x00, 0x33, 0x99, 0xCC, 0x00, 0x33, 0x99, 0xFF, 0x00, 0x33, 0xCC,
0x00, 0x00, 0x33, 0xCC, 0x33, 0x00, 0x33, 0xCC, 0x66, 0x00, 0x33, 0xCC, 0x99, 0x00, 0x33, 0xCC,
0xCC, 0x00, 0x33, 0xCC, 0xFF, 0x00, 0x33, 0xFF, 0x33, 0x00, 0x33, 0xFF, 0x66, 0x00, 0x33, 0xFF,
0x99, 0x00, 0x33, 0xFF, 0xCC, 0x00, 0x33, 0xFF, 0xFF, 0x00, 0x66, 0x00, 0x00, 0x00, 0x66, 0x00,
0x33, 0x00, 0x66, 0x00, 0x66, 0x00, 0x66, 0x00, 0x99, 0x00, 0x66, 0x00, 0xCC, 0x00, 0x66, 0x00,
0xFF, 0x00, 0x66, 0x33, 0x00, 0x00, 0x66, 0x33, 0x33, 0x00, 0x66, 0x33, 0x66, 0x00, 0x66, 0x33,
0x99, 0x00, 0x66, 0x33, 0xCC, 0x00, 0x66, 0x33, 0xFF, 0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66,
0x33, 0x00, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x99, 0x00, 0x66, 0x66, 0xCC, 0x00, 0x66, 0x99,
0x00, 0x00, 0x66, 0x99, 0x33, 0x00, 0x66, 0x99, 0x66, 0x00, 0x66, 0x99, 0x99, 0x00, 0x66, 0x99,
0xCC, 0x00, 0x66, 0x99, 0xFF, 0x00, 0x66, 0xCC, 0x00, 0x00, 0x66, 0xCC, 0x33, 0x00, 0x66, 0xCC,
0x99, 0x00, 0x66, 0xCC, 0xCC, 0x00, 0x66, 0xCC, 0xFF, 0x00, 0x66, 0xFF, 0x00, 0x00, 0x66, 0xFF,
0x33, 0x00, 0x66, 0xFF, 0x99, 0x00, 0x66, 0xFF, 0xCC, 0x00, 0xCC, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xCC, 0x00, 0x99, 0x99, 0x00, 0x00, 0x99, 0x33, 0x99, 0x00, 0x99, 0x00, 0x99, 0x00, 0x99, 0x00,
0xCC, 0x00, 0x99, 0x00, 0x00, 0x00, 0x99, 0x33, 0x33, 0x00, 0x99, 0x00, 0x66, 0x00, 0x99, 0x33,
0xCC, 0x00, 0x99, 0x00, 0xFF, 0x00, 0x99, 0x66, 0x00, 0x00, 0x99, 0x66, 0x33, 0x00, 0x99, 0x33,
0x66, 0x00, 0x99, 0x66, 0x99, 0x00, 0x99, 0x66, 0xCC, 0x00, 0x99, 0x33, 0xFF, 0x00, 0x99, 0x99,
0x33, 0x00, 0x99, 0x99, 0x66, 0x00, 0x99, 0x99, 0x99, 0x00, 0x99, 0x99, 0xCC, 0x00, 0x99, 0x99,
0xFF, 0x00, 0x99, 0xCC, 0x00, 0x00, 0x99, 0xCC, 0x33, 0x00, 0x66, 0xCC, 0x66, 0x00, 0x99, 0xCC,
0x99, 0x00, 0x99, 0xCC, 0xCC, 0x00, 0x99, 0xCC, 0xFF, 0x00, 0x99, 0xFF, 0x00, 0x00, 0x99, 0xFF,
0x33, 0x00, 0x99, 0xCC, 0x66, 0x00, 0x99, 0xFF, 0x99, 0x00, 0x99, 0xFF, 0xCC, 0x00, 0x99, 0xFF,
0xFF, 0x00, 0xCC, 0x00, 0x00, 0x00, 0x99, 0x00, 0x33, 0x00, 0xCC, 0x00, 0x66, 0x00, 0xCC, 0x00,
0x99, 0x00, 0xCC, 0x00, 0xCC, 0x00, 0x99, 0x33, 0x00, 0x00, 0xCC, 0x33, 0x33, 0x00, 0xCC, 0x33,
0x66, 0x00, 0xCC, 0x33, 0x99, 0x00, 0xCC, 0x33, 0xCC, 0x00, 0xCC, 0x33, 0xFF, 0x00, 0xCC, 0x66,
0x00, 0x00, 0xCC, 0x66, 0x33, 0x00, 0x99, 0x66, 0x66, 0x00, 0xCC, 0x66, 0x99, 0x00, 0xCC, 0x66,
0xCC, 0x00, 0x99, 0x66, 0xFF, 0x00, 0xCC, 0x99, 0x00, 0x00, 0xCC, 0x99, 0x33, 0x00, 0xCC, 0x99,
0x66, 0x00, 0xCC, 0x99, 0x99, 0x00, 0xCC, 0x99, 0xCC, 0x00, 0xCC, 0x99, 0xFF, 0x00, 0xCC, 0xCC,
0x00, 0x00, 0xCC, 0xCC, 0x33, 0x00, 0xCC, 0xCC, 0x66, 0x00, 0xCC, 0xCC, 0x99, 0x00, 0xCC, 0xCC,
0xCC, 0x00, 0xCC, 0xCC, 0xFF, 0x00, 0xCC, 0xFF, 0x00, 0x00, 0xCC, 0xFF, 0x33, 0x00, 0x99, 0xFF,
0x66, 0x00, 0xCC, 0xFF, 0x99, 0x00, 0xCC, 0xFF, 0xCC, 0x00, 0xCC, 0xFF, 0xFF, 0x00, 0xCC, 0x00,
0x33, 0x00, 0xFF, 0x00, 0x66, 0x00, 0xFF, 0x00, 0x99, 0x00, 0xCC, 0x33, 0x00, 0x00, 0xFF, 0x33,
0x33, 0x00, 0xFF, 0x33, 0x66, 0x00, 0xFF, 0x33, 0x99, 0x00, 0xFF, 0x33, 0xCC, 0x00, 0xFF, 0x33,
0xFF, 0x00, 0xFF, 0x66, 0x00, 0x00, 0xFF, 0x66, 0x33, 0x00, 0xCC, 0x66, 0x66, 0x00, 0xFF, 0x66,
0x99, 0x00, 0xFF, 0x66, 0xCC, 0x00, 0xCC, 0x66, 0xFF, 0x00, 0xFF, 0x99, 0x00, 0x00, 0xFF, 0x99,
0x33, 0x00, 0xFF, 0x99, 0x66, 0x00, 0xFF, 0x99, 0x99, 0x00, 0xFF, 0x99, 0xCC, 0x00, 0xFF, 0x99,
0xFF, 0x00, 0xFF, 0xCC, 0x00, 0x00, 0xFF, 0xCC, 0x33, 0x00, 0x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0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

hb_retclen( icon, ( 139 * 16 ) + 14 ); 
}

#pragma ENDDUMP